{"ast":null,"code":"var _s = $RefreshSig$();\nimport React from \"react\";\nimport { Context } from \"../index\";\nimport { observer } from \"mobx-react-lite\";\nconst Contacts = () => {\n  _s();\n  const {\n    store\n  } = React.useContext(Context);\n  const [contacts, setContacts] = React.useState({\n    ...(store.getContacts() || {\n      items: []\n    })\n  });\n  const [flag, setFlag] = React.useState(false);\n  React.useEffect(() => {\n    if (!flag && store.getChats().items === undefined) {\n      store.getChatsFromAPI().then();\n    } else {\n      setFlag(true);\n    }\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n  }, []);\n  React.useEffect(() => {\n    if (store.getContacts()) {\n      setContacts({\n        ...contacts,\n        ...store.getContacts()\n      });\n    }\n\n    /*        if (contacts.items) {\n                contacts.items.map((item, index) => {\n                    if (item.toUser.id === store.getProfile().id && !item.status) {\n                        addRequests.items[index] = item;\n                    } else if (item.fromUser.id === store.getProfile().id && !item.status) {\n                        sentRequests.items[index] = item;\n                    } else {\n                        allRequests.items[index] = item;\n                    }\n                });\n            }*/\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n  }, [store.contacts]);\n\n  /*    return (\n          <ContactsBlock\n              currentUser={store.getProfile()}\n              addRequestList={addRequests}\n              sentRequestList={sentRequests}\n              allAcceptedList={allRequests}\n          />\n      );*/\n};\n_s(Contacts, \"lRKeje2gRIvZyxp8urePC+JaOG4=\");\n_c = Contacts;\nexport default _c2 = observer(Contacts);\nvar _c, _c2;\n$RefreshReg$(_c, \"Contacts\");\n$RefreshReg$(_c2, \"%default%\");","map":{"version":3,"names":["React","Context","observer","Contacts","store","useContext","contacts","setContacts","useState","getContacts","items","flag","setFlag","useEffect","getChats","undefined","getChatsFromAPI","then"],"sources":["/data/messenger.client/src/containers/Contacts.tsx"],"sourcesContent":["import React from \"react\";\nimport {ContactsBlock} from \"../components/\";\nimport {Context} from \"../index\";\nimport {observer} from \"mobx-react-lite\";\nimport {ContactListResponse} from \"../models/response/ContactListResponse\";\n\nconst Contacts:React.FC = () => {\n    const {store} = React.useContext(Context);\n    const [contacts, setContacts] = React.useState<ContactListResponse>({...store.getContacts() || {items: []}});\n    const [flag, setFlag] = React.useState<boolean>(false);\n\n    React.useEffect(() => {\n        if (!flag && store.getChats().items === undefined) {\n            store.getChatsFromAPI().then();\n        } else {\n            setFlag(true);\n        }\n        // eslint-disable-next-line react-hooks/exhaustive-deps\n    }, []);\n\n    React.useEffect(() => {\n\n        if (store.getContacts()) {\n            setContacts({\n                ...contacts,\n                ...store.getContacts()\n            });\n        }\n\n/*        if (contacts.items) {\n            contacts.items.map((item, index) => {\n                if (item.toUser.id === store.getProfile().id && !item.status) {\n                    addRequests.items[index] = item;\n                } else if (item.fromUser.id === store.getProfile().id && !item.status) {\n                    sentRequests.items[index] = item;\n                } else {\n                    allRequests.items[index] = item;\n                }\n            });\n        }*/\n        // eslint-disable-next-line react-hooks/exhaustive-deps\n    }, [store.contacts]);\n\n\n/*    return (\n        <ContactsBlock\n            currentUser={store.getProfile()}\n            addRequestList={addRequests}\n            sentRequestList={sentRequests}\n            allAcceptedList={allRequests}\n        />\n    );*/\n\n};\n\nexport default observer(Contacts);"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAAQC,OAAO,QAAO,UAAU;AAChC,SAAQC,QAAQ,QAAO,iBAAiB;AAGxC,MAAMC,QAAiB,GAAG,MAAM;EAAA;EAC5B,MAAM;IAACC;EAAK,CAAC,GAAGJ,KAAK,CAACK,UAAU,CAACJ,OAAO,CAAC;EACzC,MAAM,CAACK,QAAQ,EAAEC,WAAW,CAAC,GAAGP,KAAK,CAACQ,QAAQ,CAAsB;IAAC,IAAGJ,KAAK,CAACK,WAAW,EAAE,IAAI;MAACC,KAAK,EAAE;IAAE,CAAC;EAAA,CAAC,CAAC;EAC5G,MAAM,CAACC,IAAI,EAAEC,OAAO,CAAC,GAAGZ,KAAK,CAACQ,QAAQ,CAAU,KAAK,CAAC;EAEtDR,KAAK,CAACa,SAAS,CAAC,MAAM;IAClB,IAAI,CAACF,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